#
# Copyright (C) 2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=json4lua
PKG_VERSION:=0.9.50
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/4644/$(PKG_SOURCE)

include $(INCLUDE_DIR)/package.mk

define Package/json4lua
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=JSON (Javascript Object Notation - http://www.json.org) encoding / decoding module for Lua.
  URL:=http://luaforge.net/projects/json/
  DEPENDS:=+lua
endef

define Package/json4lua/description
  JSON (Javascript Object Notation - http://www.json.org) 
  encoding / decoding module for Lua, and very basic JSON RPC 
  module (requiring socket 2.0). 
  Module requires compat-5.1 if using Lua 5.0.
endef

define Build/Prepare
	$(call Build/Prepare/Default)
endef

define Build/Configure
endef

define Build/Compile
#	find $(PKG_BUILD_DIR)/json -type f -name '*.lua' -exec $(STAGING_DIR_HOST)/bin/luac -s -o {} {} \;
endef


define Package/json4lua/install
	$(INSTALL_DIR) $(1)/usr/lib/lua
	$(CP) -a $(PKG_BUILD_DIR)/json/json.lua $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,json4lua))
